/*-
 * CT.java          TP-Command-Type (TP-CT)
 *
 * $LastChangedBy: stein $
 * $LastChangedRevision: 95 $
 * $LastChangedDate: 2007-02-13 16:19:24 +0000 (Tue, 13 Feb 2007) $
 * $HeadURL: svn://localhost/SMS/src/com/googlecode/attention/sms/pdu/CT.java $
 *
 * Copyright (c) 2007, Stein Gunnar Bakkeby
 * All rights reserved.
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 *     * Redistributions of source code must retain the above copyright
 *       notice, this list of conditions and the following disclaimer.
 *     * Redistributions in binary form must reproduce the above copyright
 *       notice, this list of conditions and the following disclaimer in the
 *       documentation and/or other materials provided with the distribution.
 *     * Neither the name of Stein Gunnar Bakkeby nor the names of its
 *       contributors may be used to endorse or promote products derived
 *       from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS" AND ANY
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY
 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
package com.googlecode.attention.sms.pdu;

import static com.googlecode.attention.util.bit.ByteBitValues.*;

/**
 * TP-Command-Type (TP-CT).
 * <BR>
 * <BR>The TP-Command-Type is an 8-bit field specifying the type of operation
 * that the SC is to perform. It has the following values:
 * <BR>
 * <BR>
 * <TABLE BORDER="1">
 * <TR><TD>Value (bit 7 .. 0)</TD><TD>Command Description</TD><TD>Status Report Request Value</TD></TR>
 * <TR><TD>00000000</TD><TD>Enquiry relating to previously submitted short message</TD><TD>1</TD></TR>
 * <TR><TD>00000001</TD><TD>Cancel Status Report Request relating to previously submitted short message</TD><TD>0</TD></TR>
 * <TR><TD>00000010</TD><TD>Delete previously submitted Short Message</TD><TD>0</TD></TR>
 * <TR><TD>00000011</TD><TD>Enable Status Report Request relating to previously submitted short message</TD><TD>0</TD></TR>
 * <TR><TD>00000100..00011111</TD><TD>Reserved</TD><TD>unspecified</TD></TR>
 * <TR><TD>11100000..11111111</TD><TD>Values specific for each SC</TD><TD>1 or 0</TD></TR>
 * </TABLE>
 * <BR>
 * <BR>The SC shall return an RP-Error with an appropriate TP-Failure-Cause
 * for any TP-Command value which is reserved, unsupported or invalid or the
 * action of the command has failed.
 * <BR>
 * <BR>The SC shall return an RP-ACK if the action of the Command has
 * succeeded.
 * <BR>
 * <BR>A successful Enquiry shall result in the SC sending a SMS-STATUS-REPORT
 * for the SM to which the Enquiry refers. In the case where the SC has a
 * number of SMs which have the same TP-MR, the same TP-DA and have come
 * from the same originating address the SC shall send a SMS-STATUS-REPORT
 * for each SM.
 * <BR>
 * <BR>In the case where a TP-Command is to Delete a previously submitted
 * short message, the SC shall send a Status Report indicating that the SM has
 * been deleted if the original Submit SM request requested a status Report.
 * 
 * @author Stein Gunnar Bakkeby
 */
public class CT extends com.googlecode.attention.util.IntValue {
  
  /* Static field values */
  /** Enquiry relating to previously submitted short message, SRR = 1. */
  public static final int ENQUIRY_RELATING_TO_PREVIOUSLY_SUBMITTED_SM = 0;
  /**
   * Cancel Status Report Request relating to previously
   * submitted short message, SRR = 0.
   */ 
  public static final int CANCEL_STATUS_REPORT_REQUEST                = 1;
  /** Delete previously submitted Short Message, SRR = 0. */
  public static final int DELETE_PREVIOUSLY_SUBMITTED_SM              = 2;
  /**
   * Enable Status Report Request relating to previously
   * submitted short message, SRR = 0.
   */
  public static final int ENABLE_STATUS_REPORT_REQUEST                = 3;
  
  /* Values   4 to  31 reserved, SRR = unspecified. */
  /* Values 224 to 255 specific for each SC, SRR = 1 or 0. */
  
  /** Inherited constructor from IntValue. */
  public CT() {
    super(0);
  }
  
  /**
   * Inherited constructor from IntValue.
   * @param value The value of this object
   */
  public CT(final int value) {
    super(value);
  }
  
  /**
   * Inherited constructor from IntValue.
   * @param hex The value of this object in hex
   */
  public CT(final String hex) {
    super(hex);
  }
    
  /**
   * This will set the CT value. 
   * 
   * @param value Integer in the range of 0 - 255, will be masked by 0xFF.
   */
  public void setValue(final int value) {
    this.value = value & ALL;
  }
}